package com.dark.sys.entity;

import javax.persistence.Entity;
import javax.persistence.Table;

import org.apache.commons.lang3.RandomStringUtils;

import com.dark.common.entity.BaseEntity;

@Entity @Table(name="sys_user")
public class User extends BaseEntity<Integer> {
	
	private static final long serialVersionUID = 1L;

	/** 用户名 */
	private String username;

    /** 使用md5(username + original password + salt)加密存储 */
    private String password;

    /** 加密密码时使用的种子 */
    private String salt;

    /** 移动电话 */
    private String mobile_phone_number;

    /** 邮箱地址 */
    private String email;

    /** 系统用户的状态 normal("正常状态"), blocked("封禁状态"); */
    private String status = "normal" ;

    /** 是否是管理员 */
    private Boolean admin = Boolean.FALSE;

    /** 逻辑删除flag */
    private Boolean deleted = Boolean.FALSE;

    
	/**
     * 生成新的种子
     */
    public void randomSalt() {
        setSalt(RandomStringUtils.randomAlphanumeric(10));
    }

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getSalt() {
		return salt;
	}

	public void setSalt(String salt) {
		this.salt = salt;
	}


	public String getMobile_phone_number() {
		return mobile_phone_number;
	}

	public void setMobile_phone_number(String mobile_phone_number) {
		this.mobile_phone_number = mobile_phone_number;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public Boolean getAdmin() {
		return admin;
	}

	public void setAdmin(Boolean admin) {
		this.admin = admin;
	}

	public Boolean getDeleted() {
		return deleted;
	}

	public void setDeleted(Boolean deleted) {
		this.deleted = deleted;
	}

}
